<template>
  <div>
      <h3>当前最新的count值为:{{count}}</h3>
      <h4>{{showNum}}</h4>
      <button @click="sub">-1</button>
      <button @click="subn">-{{n}}</button>
      <button @click="waitsub">-1 Async</button>
      <button @click="waitsubn">-n Async</button>
      <button @click="handlerefresh">刷新additon</button>
  </div>
</template>

<script>
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex'
export default {
  data() {
    return {
      n:8
    }
  },
  methods: {
    ...mapMutations(['substac','substacN']),
    ...mapActions(['subasync','subasyncn']),

    sub(){
      this.substac()
    },
    subn(){
      this.substacN(this.n)
    },
    waitsub(){
      this.subasync()
    },
    waitsubn(){
      this.subasyncn(this.n)
    },
    handlerefresh(){
      this.$emit("refrshlist")
    }

  },
  computed:{
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  }
}
</script>

<style>

</style>